Q I've been experimenting to see what happens when a print job is
cancelled part of the way through, and if I cancel when OpenConnection and
StartSendPage have both completed successfully, I get unexpected
CleanUpOpenConnection and CleanupStartSendPage messages. If I cancel at another
other point in the job (for example, during RenderPage via the Remove button in
the DTP status window), CleanUpStartSendPage and CleanUpOpenConnection messages
are passed through after ImageDocument exits. This behavior seems very odd, and
it doesn't appear to be discussed anywhere in the documentation. Shouldn't
CleanUpOpenConnection and CleanupStartSendPage be called only if their
respective routines return an error?
A The unexpected CleanUpOpenConnection and CleanupStartSendPage messages are
coming from the default implementations of ImageJob and ImagePage. The ImageJob
code tries to Send_GXSetupImageData, and if an error occurs, it sends
CleanUpOpenConnection. ImagePage tries to Send_GXRenderPage and sends
CleanupStartSendPage if an error occurs.
If GXStartSendPage and/or GXOpenConnection do not complete successfully, the
respective clean-up calls are not sent. These clean-up calls are sent only if
openConnection and/or startSendPage are completed, and something goes wrong
after completion.
Although the documentation states otherwise, this behavior is correct for the
existing code, as shown here:
ImageJob
...
Send_GXOpenConnection(_);
if (anErr) <dispose of data>Send_GXSetupImageData(_);
if (anErr)
{
Send_GXCleanUpOpenConnection(_);
<dispose of data>}
...
ImagePage
...
Send_GXStartSendPage(_);
if (anErr) <dispose of data>Send_GXRenderPage(_);
if (anErr)
{
Send_GXCleanupStartSendPage(_);
<dispose of data>}
...